﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Tetris
{
    [Serializable]
    public class RightS : Shape
    {
        //global number of state for the shape
        public static int NbState = 2;

        /// <summary>
        /// Basic constructor used when we deserialize
        /// </summary>
        public RightS() : base()
        {
            points.Clear();
        }

        /// <summary>
        ///  Basic constructor
        /// </summary>
        public RightS(bool test) : base()
        {
            points[1].X=3;
            points[1].Y=0;
            points[0].X=4;
            points[0].Y=0;
            points[2].X=4;
            points[2].Y=1;
            points[3].X=5;
            points[3].Y=1;
            state = 1;
        }

        /// <summary>
        /// Organized how the RightL will rotate according to its current state
        /// </summary>
        /// <param name="sens">Shape.COUNTCLOCKWISE or Shape.CLOCKWISE</param>
        public override void rotate(int sens)
        {
            if(state==1){
                    points[1].X=points[1].X + 1;
                    points[1].Y=points[1].Y + 1;
                    points[2].X=points[2].X + 1;
                    points[2].Y=points[2].Y - 1;
                    points[3].X=points[3].X;
                    points[3].Y=points[3].Y - 2;
                    state = 2;
            }
            else if(state==2){
                    points[1].X=points[1].X - 1;
                    points[1].Y=points[1].Y - 1;
                    points[2].X=points[2].X - 1;
                    points[2].Y=points[2].Y + 1;
                    points[3].X=points[3].X;
                    points[3].Y=points[3].Y + 2;
                    state = 1;
            }
        }
    }
}
